package com.example.demo.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class Result<T> implements Serializable {

	private static final long serialVersionUID = -4497668325599752723L;

	private String code;
	private String msg;
	private T data;

	public static <T> Result<T> success(String msg){
		return new Result<T>().setMsg(msg);
	}

	public static <T> Result<T> success(T data){
		return new Result<T>().setData(data);
	}

	public static <T> Result<T> fail(String msg){
		return new Result<T>().setMsg(msg);
	}

}
